<%@ page language="java" import="java.util.*" import="java.text.SimpleDateFormat"  contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'Demo.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
    <title>车票查看界面</title>
  </head>
  
  <body style=background-image:url(10.jpg);>
   <center>
   <h1><font color="red">12593铁路中心车票信息查看及预订界面</font></h1>
   <hr/>
   <br/>
   <br/>
         <h1>您所要查询的车票信息如下</h1>
        <%
        
		request.setCharacterEncoding("utf-8");
        List all = null ;
		all = (List)request.getAttribute("all");
		String s = "2012-05-07 15:57:30";
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        %>
          <table>
          <tr>
             <td>您要搜索的是<font size="5" color="blue"><%=request.getParameter("setSta")%></font>到<font size="5"  color="blue"><%=request.getParameter("arSta")%></font>的动车信息：</td>
         </tr>
          </table>
    
		<% 
		String page1 = request.getParameter("page");
		if(page1 == null) {
			page1 = "1";
		}
		int pageInt = Integer.parseInt(page1) -1;
		if (pageInt < 0) {
			pageInt = 0;
		}
		int i =0;
		
		%>
		 <table  width = "80%">
           <tr>
				<td><a href = "ticketInfo04.jsp">返回查询页面</a></td>
		  </tr>
		  <tr>

			          <td>车次</td>
					  <td>出发站</td>	
					  <td>到达站</td>
					  <td>出发时间</td>
					  <td>用时</td>
					  <td>座位级别</td>
					  <td>车厢号</td>
					  <td>座位号</td>
			          <td>价格</td>
			          <td>修改</td>
		 </tr>
	    <%
		  Iterator iter = all.iterator();
		    while(iter.hasNext()){
			  i++;
			  pageContext.setAttribute("t",iter.next());
		%>
		<tr>
				  		<td>${t.TId }</td>
				  		<td>${t.setSta }</td>
				  		<td>${t.arSta }</td>
				  		<td>${t.setDate }</td>
				  		<td>${t.useTime }</td>
				  		<td>${t.seatL }</td>
				  		<td>${t.carr }</td>
				  		<td>${t.seatN }</td>
				  		<td>${t.price }</td>
				  		<td><a href="ModifyTicketIn.jsp?tid=${t.TId }&carr=${t.carr }&seatn=${t.seatN }&price=${t.price onclick="return confirm('确认要修改该车票的价格吗？'}">修改</a></td>
		 </tr>
		  <%
		    }
		   %> 
		</table>
		      <%
		if(i==0) {
			  %>
			  <h1>没有该车票的相关信息！！！</h1>
			  <%	
			    }else{
	  		  %>
		 
		<a href="ticketInfo01.jsp?page=1">首页</a>
		  <a href="ticketInfo01.jsp?page=<%=Integer.parseInt(page1)-1%>">上一页</a>
  		  <a href="ticketInfo01.jsp?page=<%=Integer.parseInt(page1)+1%>">下一页</a>
        <%} %>
   </center>
  </body>
</html>
